﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGiMapper : IDisposable
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGiMapper(IntPtr cPtr, bool cMemoryOwn)
		{
			this.swigCMemOwn = cMemoryOwn;
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGiMapper obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGiMapper()
		{
			this.Dispose();
		}

		public virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGiMapper(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		public static OdGiMapper kIdentity
		{
			get
			{
				IntPtr intPtr = GlobalsPINVOKE.OdGiMapper_kIdentity_get();
				OdGiMapper result = (intPtr == IntPtr.Zero) ? null : new OdGiMapper(intPtr, false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
		}

		public OdGiMapper() : this(GlobalsPINVOKE.new_OdGiMapper__SWIG_0(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGiMapper(OdGiMapper mapper) : this(GlobalsPINVOKE.new_OdGiMapper__SWIG_1(OdGiMapper.getCPtr(mapper)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGiMapper Assign(OdGiMapper mapper)
		{
			OdGiMapper result = new OdGiMapper(GlobalsPINVOKE.OdGiMapper_Assign(this.swigCPtr, OdGiMapper.getCPtr(mapper)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool IsEqual(OdGiMapper mapper)
		{
			bool result = GlobalsPINVOKE.OdGiMapper_IsEqual(this.swigCPtr, OdGiMapper.getCPtr(mapper));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool IsNotEqual(OdGiMapper mapper)
		{
			bool result = GlobalsPINVOKE.OdGiMapper_IsNotEqual(this.swigCPtr, OdGiMapper.getCPtr(mapper));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setProjection(OdGiMapper.Projection projection)
		{
			GlobalsPINVOKE.OdGiMapper_setProjection(this.swigCPtr, (int)projection);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setUTiling(OdGiMapper.Tiling tiling)
		{
			GlobalsPINVOKE.OdGiMapper_setUTiling(this.swigCPtr, (int)tiling);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setVTiling(OdGiMapper.Tiling tiling)
		{
			GlobalsPINVOKE.OdGiMapper_setVTiling(this.swigCPtr, (int)tiling);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setAutoTransform(OdGiMapper.AutoTransform autoTransform)
		{
			GlobalsPINVOKE.OdGiMapper_setAutoTransform(this.swigCPtr, (int)autoTransform);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeMatrix3d transform()
		{
			OdGeMatrix3d result = new OdGeMatrix3d(GlobalsPINVOKE.OdGiMapper_transform__SWIG_0(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGiMapper.Projection projection()
		{
			OdGiMapper.Projection result = (OdGiMapper.Projection)GlobalsPINVOKE.OdGiMapper_projection(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGiMapper.Tiling uTiling()
		{
			OdGiMapper.Tiling result = (OdGiMapper.Tiling)GlobalsPINVOKE.OdGiMapper_uTiling(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGiMapper.Tiling vTiling()
		{
			OdGiMapper.Tiling result = (OdGiMapper.Tiling)GlobalsPINVOKE.OdGiMapper_vTiling(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGiMapper.AutoTransform autoTransform()
		{
			OdGiMapper.AutoTransform result = (OdGiMapper.AutoTransform)GlobalsPINVOKE.OdGiMapper_autoTransform(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setTransform(OdGeMatrix3d tm)
		{
			GlobalsPINVOKE.OdGiMapper_setTransform(this.swigCPtr, OdGeMatrix3d.getCPtr(tm));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		protected bool swigCMemOwn;

		public enum Projection
		{
			kInheritProjection,
			kPlanar,
			kBox,
			kCylinder,
			kSphere,
			kDgnParametric = 50,
			kDgnPlanar,
			kDgnCylinder,
			kDgnCylinderCapped,
			kDgnSphere
		}

		public enum Tiling
		{
			kInheritTiling,
			kTile,
			kCrop,
			kClamp,
			kMirror
		}

		[Flags]
		public enum AutoTransform
		{
			kInheritAutoTransform = 0,
			kNone = 1,
			kObject = 2,
			kModel = 4
		}
	}
}
